// ============================================================================ // PeekPlug.h // ============================================================================ // Copyright (c) WildPackets, Inc. 2000-2002. All rights reserved. // Copyright (c) AG Group, Inc. 1997-2000. All rights reserved. #ifndef PEEKPLUG_H #define PEEKPLUG_H #include "StdAfx.h" #include "AGTypes.h" #include "PacketHeaders.h" #ifdef __cplusplus namespace PeekPlugin { extern "C" { #endif #pragma pack(push,1) // The API version. #define kPluginAPIVersion 8 // Plug-in identifier (same as GUID). typedef struct PluginID { UInt32 Data1; UInt16 Data2; UInt16 Data3; UInt8 Data4[8]; } PluginID; // Opaque type used by application to store context. typedef void* PluginAppContext; // Opaque type used by application to store context. typedef void* PluginCaptureContext; // Opaque type used by plug-ins to store private data. typedef void* PluginContext; // Other context data passed with CreateContext. typedef void* PluginContextData; // Plug-in context flags. typedef UInt32 PluginContextFlags; // Plug-in color type. typedef COLORREF PluginColor; // Plug-in attributes. enum { kPluginAttr_ProcessPackets = 0x0001, kPluginAttr_GetPacketString = 0x0002, kPluginAttr_HandlesSelection = 0x0004, kPluginAttr_HandlesSummaries = 0x0008, kPluginAttr_HasOptions = 0x0010, kPluginAttr_Filters = 0x0020, kPluginAttr_HandlesErrorPackets = 0x0040, kPluginAttr_ProvidesSummaryDescr= 0x0080, kPluginAttr_NameTableUpdates = 0x0100, kPluginAttr_ProvidesAnalysis = 0x0200, kPluginAttr_HandlesApply = 0x0400, kPluginAttr_PluginAdapter = 0x0800, kPluginAttr_DecodePackets = 0x1000, }; // Actions supported by plug-ins. enum { kPluginAction_None = 0x0000, // No actions kPluginAction_Display = 0x0001, // Show info in main list. kPluginAction_Notify = 0x0002 // Notify message. }; // Messages passed to the main routine of plug-ins. enum { kPluginMsg_Load, // 0 PluginLoadParam kPluginMsg_Unload, // 1 NULL kPluginMsg_ReadPrefs, // 2 NULL kPluginMsg_WritePrefs, // 3 NULL kPluginMsg_CreateContext, // 4 PluginCreateContextParam kPluginMsg_DisposeContext, // 5 PluginDisposeContextParam kPluginMsg_ProcessPacket, // 6 PluginProcessPacketParam kPluginMsg_GetPacketString, // 7 PluginGetPacketStringParam kPluginMsg_Apply, // 8 PluginApplyParam kPluginMsg_Select, // 9 PluginSelectParam kPluginMsg_Reset, // 10 PluginResetParam kPluginMsg_StartCapture, // 11 PluginStartCaptureParam kPluginMsg_StopCapture, // 12 PluginStopCaptureParam kPluginMsg_PacketsLoaded, // 13 PluginPacketsLoadedParam kPluginMsg_About, // 14 NULL kPluginMsg_Options, // 15 NULL kPluginMsg_Summary, // 16 PluginSummaryParam kPluginMsg_Filter, // 17 PluginFilterParam kPluginMsg_FilterOptions, // 18 NULL kPluginMsg_SummaryDescr, // 19 PluginSummaryDescrParam kPluginMsg_NameTableUpdate, // 20 PluginNameTableUpdateParam kPluginMsg_GetPacketAnalysis, // 21 PluginGetPacketStringParam kPluginMsg_CreateNewAdapter, // 22 PluginCreateNewAdapterParam kPluginMsg_GetAdapterList, // 23 PluginGetAdapterListParam kPluginMsg_DeleteAdapter, // 24 PluginDeleteAdapterParam kPluginMsg_SetAdapterAttribs, // 25 PluginAdapterAttribsParam kPluginMsg_GetAdapterAttribs, // 26 PluginAdapterAttribsParam kPluginMsg_DecodePacket, // 27 PluginDecodePacketParam kPluginMsg_AdapterProperties, // 28 PluginAdapterPropertiesParam }; // Commands for apply messages. enum { kApplyMsg_Start, kApplyMsg_End, kApplyMsg_Packet }; // Commands for select messages. enum { kSelectMsg_Start, kSelectMsg_End, kSelectMsg_Packet }; // Commands for name table update messages. enum { kNameTableUpdateMsg_Add, kNameTableUpdateMsg_Edit, kNameTableUpdateMsg_Delete }; // Entry types used in the LookupName, LookupEntry, and AddNameEntry callbacks. enum { kEntryType_PhysicalAddr, // 6-byte entry. kEntryType_AppleTalkAddr, // 4-byte entry (socket ignored). kEntryType_IPAddr, // 4-byte entry. kEntryType_DECnetAddr, // 6-byte entry. kEntryType_IPv6Addr, // 16-byte entry. kEntryType_IPPort, // 2-byte entry. kEntryType_ProtoSpec, // 2-byte entry. kEntryType_NWPort, // 2-byte entry. kEntryType_WirelessAddr, // 6-byte entry. kEntryType_IPXAddr // 10-byte entry. }; // Host types for name lookup. enum { kHostType_Unknown, kHostType_Workstation, kHostType_Server, kHostType_Router, kHostType_Switch, kHostType_Repeater, kHostType_Printer, kHostType_AccessPoint }; // AddNameEntry callback options. enum { kSetEntryName_NoMatchAdd = 0x0001, kSetEntryName_NoMatchSkip = 0x0002, kSetEntryName_NameMatchAdd = 0x0010, kSetEntryName_NameMatchReplace = 0x0020, kSetEntryName_NameMatchSkip = 0x0040, kSetEntryName_AddrMatchAdd = 0x0100, kSetEntryName_AddrMatchReplace = 0x0200, kSetEntryName_AddrMatchSkip = 0x0400 }; // Used for NameTable calls. typedef struct PluginNameTableEntry { UInt8* fEntry; TCHAR* fName; TCHAR* fGroup; PluginColor fColor; UInt16 fEntryType; UInt8 fHostType; } PluginNameTableEntry; // Byte/count pair for summary statistics. typedef struct ByteCountPair { UInt64 fBytes; UInt64 fCount; } ByteCountPair; // Summary type sizes. enum { kPluginSummarySize_Mask = 0x000000F0, kPluginSummarySize_UInt8 = 0x00000010, kPluginSummarySize_UInt16 = 0x00000020, kPluginSummarySize_UInt32 = 0x00000030, kPluginSummarySize_UInt64 = 0x00000040, kPluginSummarySize_ByteCountPair = 0x00000050, kPluginSummarySize_Double = 0x00000060 }; // Summary types. enum { kPluginSummaryType_Mask = 0x0000000F, kPluginSummaryType_Date = 0x00000001, kPluginSummaryType_Time = 0x00000002, kPluginSummaryType_Duration = 0x00000003, kPluginSummaryType_PacketCount = 0x00000004, kPluginSummaryType_ByteCount = 0x00000005, kPluginSummaryType_BothCount = 0x00000006, kPluginSummaryType_OtherCount = 0x00000007 }; // Summary flags. enum { kPluginSummaryFlag_Mask = 0x00000F00, kPluginSummaryFlag_Ungraphable = 0x00000100, kPluginSummaryFlag_IsOverTime = 0x00000200, kPluginSummaryFlag_IsSampled = 0x00000400 }; // Severity Levels for NotifyProc. enum { kNotifySeverity_Informational, kNotifySeverity_Minor, kNotifySeverity_Major, kNotifySeverity_Severe }; // Media types. enum { kPluginPacketMediaType_802_3, kPluginPacketMediaType_802_5 }; // Physical medium. enum { kPluginPacketMediaSubType_Native, kPluginPacketMediaSubType_80211_b, kPluginPacketMediaSubType_80211_a, kPluginPacketMediaSubType_80211_gen, // combination of all known 802.11 media types }; // Flags for PluginPacket. enum { kPluginPacketFlag_Control = 0x01, // Control vs. data packet. kPluginPacketFlag_CRC = 0x02, // Checksum error. kPluginPacketFlag_Frame = 0x04, // Frame error. kPluginPacketFlag_RouteInfo = 0x08, // Has routing info (Token Ring). kPluginPacketFlag_Oversize = 0x10, // Oversize error. kPluginPacketFlag_Runt = 0x20, // Runt error. kPluginPacketFlag_Trigger = 0x40, // Trigger packet. kPluginPacketFlag_SNAP = 0x80 // SNAP packet. }; // Status flags for PluginPacket. enum { kPluginPacketStatus_Truncated = 0x02, // Truncated packet. kPluginPacketStatus_Encrypted = 0x04, // Originally encrypted (e.g., WEP). kPluginPacketStatus_DecryptionError = 0x08, // Decryption error (e.g., WEP ICV). kPluginPacketStatus_Sliced = 0x20, // Sliced packet. kPluginPacketStatus_ShortPreamble = 0x40 // Short preamble. }; // Offset values for PacketGetLayer. enum { kPacketLayerType_Header = 0x00, kPacketLayerType_Data = 0x80, kPacketLayer_Physical = 0x00, kPacketLayer_IP = 0x01, kPacketLayer_UDP = 0x02, kPacketLayer_TCP = 0x03, kPacketLayer_ICMP = 0x04 }; // Address types for PacketGetAddress. enum { kAddressType_SrcPhysical, kAddressType_DestPhysical, kAddressType_SrcLogical, kAddressType_DestLogical, kAddressType_BSSID, kAddressType_Receiver, kAddressType_Transmitter, kAddressType_Address1, kAddressType_Address2, kAddressType_Address3, kAddressType_Address4 }; // Context types for CreateContext. enum { kContextType_Global = 0x00, kContextType_CaptureWindow = 0x01, kContextType_FileWindow = 0x02 }; // Select Packets flags. enum { kSelectPacketsFlag_ReplaceSelection = 0x00, kSelectPacketsFlag_AddToSelection = 0x01, kSelectPackets_FlagMask = 0x0F }; // Select Packets actions. enum { kSelectPacketsAction_PromptUser = 0x00, kSelectPacketsAction_HideSelected = 0x10, kSelectPacketsAction_HideUnselected = 0x20, kSelectPackets_ActionMask = 0xF0 }; // XML tags for adapter plugins params #define kAdapterTag_StartCaptureText _T("StartCaptureText") #define kAdapterTag_StopCaptureText _T("StopCaptureText") #define kAdapterEle_Group _T("Group") #define kAdapterEle_Adapter _T("Adapter") #define kAdapterTag_Name _T("Name") #define kAdapterTag_ID _T("ID") #define kAdapterTag_Speed _T("LinkSpeed") #define kAdapterTag_DefaultSpeed _T("DefaultLinkSpeed") #define kAdapterTag_MediaType _T("MediaType") #define kAdapterTag_MediaSubType _T("MediaSubType") #define kAdapterTag_Deletable _T("Deletable") #define kAdapterVal_False _T("false") #define kAdapterVal_True _T("true") #define kAdapterTag_Address _T("Address") #define kAdapterTag_PluginID _T("PluginID") #define kAdapterTag_Device _T("Device") // a field in the adapter list #define kAdapterTag_Properties _T("Properties") // supports properties // wireless adapter attribs #define kAdapterTag_CurrentSetting _T("Setting") // one of the adapter tags below #define kAdapterTag_Channel _T("Channel") // channel # #define kAdapterTag_ESSID _T("ESSID") // ESSID (name) #define kAdapterTag_BSSID _T("BSSID") // BSSID (MAC addr) #define kAdapterTag_ChannelScan _T("Scanning") // children are kAdapterTag_Channel with Enabled (=true/false) and Duration (in ms) attribs #define kAdapterTag_Enabled _T("Enabled") #define kAdapterTag_Duration _T("Duration") #define kAdapterTag_WEPKeys _T("WEP") // (set/get) contains the name of the keyset as an attib (kAdapterTag_Name) // (set) children are kAdapterTag_Key with attrib kAdapterTag_KeyNum and WEP key in hex as value #define kAdapterTag_Key _T("Key") #define kAdapterTag_KeyNum _T("KeyNum") // A packet. typedef struct PluginPacket { UInt32 fProtoSpec; // ProtoSpec ID. UInt16 fPacketLength; // Total length of packet. UInt16 fSliceLength; // Sliced length of packet or zero. UInt8 fFlags; // CRC, frame, runt, ... UInt8 fStatus; // Slicing, ... UInt64 fTimeStamp; // Timestamp in microseconds. Wireless80211PrivateHeader fWirelessHeader; // all 0 in non-WIRELESS products } PluginPacket; #if TARGET_OS_WIN32 #define PeekPlugCallback_( inReturnType, inFunctionName ) inReturnType (WINAPI * inFunctionName ) #elif TARGET_OS_MAC #define PeekPlugCallback_( inReturnType, inFunctionName ) pascal inReturnType (* inFunctionName ) #endif // Callpack function typedefs typedef PeekPlugCallback_( int, GetProtocolNameProc ) ( UInt32 inProtocol, wchar_t* outString ); typedef PeekPlugCallback_( int, GetProtocolLongNameProc ) ( UInt32 inProtocol, wchar_t* outString ); typedef PeekPlugCallback_( int, GetProtocolHierNameProc ) ( UInt32 inProtocol, wchar_t* outString ); typedef PeekPlugCallback_( int, GetProtocolParentProc ) ( UInt32 inProtocol, UInt32* outProtocolParent ); typedef PeekPlugCallback_( int, GetProtocolColorProc ) ( UInt32 inProtocol, PluginColor* outColor ); typedef PeekPlugCallback_( int, IsDescendentOfProc ) ( UInt32 inSubProtocol, const UInt32* inParentArray, SInt32 inParentCount, UInt32 *outMatchID ); typedef PeekPlugCallback_( int, NotifyProc ) ( PluginAppContext inAppContext, PluginCaptureContext inCaptureContext, UInt64 inTimeStamp, UInt8 inSeverity, const wchar_t* inShortString, const wchar_t* inLongString ); typedef PeekPlugCallback_( int, LookupNameProc ) ( PluginNameTableEntry* ioEntry ); typedef PeekPlugCallback_( int, LookupEntryProc ) ( PluginNameTableEntry* ioEntry ); typedef PeekPlugCallback_( int, AddNameEntryProc ) ( const PluginNameTableEntry* inEntry, UInt32 inOptions ); typedef PeekPlugCallback_( int, SummaryGetEntryProc ) ( PluginAppContext inAppContext, PluginCaptureContext inCaptureContext, const wchar_t* inLabel, const wchar_t* inGroup, UInt32* outType, void** outData, UInt8* outSource ); typedef PeekPlugCallback_( int, SummaryModifyEntryProc ) ( PluginAppContext inAppContext, PluginCaptureContext inCaptureContext, const wchar_t* inLabel, const wchar_t* inGroup, UInt32 inType, void* inData ); typedef PeekPlugCallback_( UInt8 *, PacketGetLayerProc ) ( UInt8 inLayerType, UInt8 inMediaType, UInt8 inSubType, const PluginPacket* inPacket, const UInt8* inPacketData, UInt16* ioBytesLeft ); typedef PeekPlugCallback_( UInt8 *, PacketGetDataLayerProc ) ( UInt32 inProtoSpec, UInt8 inMediaType, UInt8 inSubType, const PluginPacket* inPacket, const UInt8* inPacketData, UInt16* ioBytesLeft, UInt32* outSourceProtoSpec ); typedef PeekPlugCallback_( UInt8 *, PacketGetHeaderLayerProc ) ( UInt32 inLayerType, UInt8 inMediaType, UInt8 inSubType, const PluginPacket* inPacket, const UInt8* inPacketData, UInt16* ioBytesLeft, UInt32* outSourceProtoSpec ); typedef PeekPlugCallback_( int, PacketGetAddressProc ) ( PluginAppContext inAppContext, PluginCaptureContext inCaptureContext, UInt8 inAddressSelector, UInt8 inMediaType, UInt8 inSubType, const PluginPacket* inPacket, const UInt8* inPacketData, UInt64 inPacketNumber, UInt8* outAddress, UInt16* outAddressType ); typedef PeekPlugCallback_( int, PrefsGetValueProc ) ( PluginAppContext inAppContext, PluginCaptureContext inCaptureContext, const wchar_t* inName, const void* outData, UInt32* ioLength ); typedef PeekPlugCallback_( int, PrefsSetValueProc ) ( PluginAppContext inAppContext, PluginCaptureContext inCaptureContext, const wchar_t* inName, const void* inData, UInt32 inLength ); typedef PeekPlugCallback_( int, SendPacketProc ) ( const UInt8* inPacketData, UInt16 inPacketLength ); typedef PeekPlugCallback_( int, InsertPacketProc ) ( PluginAppContext inAppContext, PluginCaptureContext inCaptureContext, const PluginPacket* inPacket, const UInt8* inPacketData, UInt8 inMediaType, UInt8 inSubType, UInt32 inReserved ); typedef PeekPlugCallback_( int, SelectPacketsProc ) ( PluginAppContext inAppContext, PluginCaptureContext inCaptureContext, UInt32 inPacketCount, UInt64* inPacketArray, UInt32 inFlags ); #if TARGET_OS_WIN32 typedef PeekPlugCallback_( int, AddTabProc ) ( PluginAppContext inAppContext, PluginCaptureContext inCaptureContext, const wchar_t* inTabName, const wchar_t* inWindowClass, void** outTabWnd ); typedef PeekPlugCallback_( int, SelectPacketsExProc ) ( PluginAppContext inAppContext, PluginCaptureContext inCaptureContext, const UInt8* inSrcAddr, UInt16 inSrcAddrType, const UInt8* inDestAddr, UInt16 inDestAddrType, UInt16 inSrcPort, UInt16 inDestPort, UInt16 inPortTypes, bool inBothDirections, UInt32 inFlags ); typedef PeekPlugCallback_( int, MakeFilterProc ) ( const UInt8* inSrcAddr, UInt16 inSrcAddrType, const UInt8* inDestAddr, UInt16 inDestAddrType, UInt16 inSrcPort, UInt16 inDestPort, UInt16 inPortTypes, bool inBothDirections ); typedef PeekPlugCallback_( int, ClaimPacketStringProc ) ( PluginAppContext inAppContext, PluginCaptureContext inCaptureContext, UInt64 inPacketNumber, bool inExpert ); typedef PeekPlugCallback_( int, InvokeNameEditDialogProc) ( PluginNameTableEntry* inEntry ); typedef PeekPlugCallback_( int, PrefsGetPrefsPathProc ) ( wchar_t* outString ); typedef PeekPlugCallback_( int, ResolveAddressProc ) ( UInt8* inAddress, UInt16 inAddressType ); typedef PeekPlugCallback_( int, GetAppResourcePathProc ) ( wchar_t* outAppResourcePath ); #elif TARGET_OS_MAC typedef PeekPlugCallback_( void, EventDispatchProc ) ( const EventRecord* inEvent ); // probably obsolete: we have Carbon Event technology now #endif #if TARGET_OS_WIN32 // Export names for the callbacks. #define kExportName_GetProtocolName _T("GetProtocolNameCallback") #define kExportName_GetProtocolLongName _T("GetProtocolLongNameCallback") #define kExportName_GetProtocolHierName _T("GetProtocolHierNameCallback") #define kExportName_GetProtocolParent _T("GetProtocolParentCallback") #define kExportName_GetProtocolColor _T("GetProtocolColorCallback") #define kExportName_IsDescendentOf _T("IsDescendentOfCallback") #define kExportName_Notify _T("NotifyCallback") #define kExportName_LookupName _T("LookupNameCallback") #define kExportName_LookupEntry _T("LookupEntryCallback") #define kExportName_AddNameEntry _T("AddNameEntryCallback") #define kExportName_SendPacket _T("SendPacketCallback") #define kExportName_SummaryModifyEntry _T("SummaryModifyEntryCallback") #define kExportName_SummaryGetEntry _T("SummaryGetEntryCallback") #define kExportName_PacketGetLayer _T("PacketGetLayerCallback") #define kExportName_PacketGetDataLayer _T("PacketGetDataLayerCallback") #define kExportName_PacketGetHeaderLayer _T("PacketGetHeaderLayerCallback") #define kExportName_PacketGetAddress _T("PacketGetAddressCallback") #define kExportName_PrefsGetValue _T("PrefsGetValueCallback") #define kExportName_PrefsSetValue _T("PrefsSetValueCallback") #define kExportName_InsertPacket _T("InsertPacketCallback") #define kExportName_SelectPackets _T("SelectPacketsCallback") #define kExportName_SelectPacketsEx _T("SelectPacketsExCallback") #define kExportName_ClaimPacketString _T("ClaimPacketStringCallback") #define kExportName_InvokeNameEditDialog _T("InvokeNameEditDialogCallback") #define kExportName_AddTab _T("AddTabCallback") #define kExportName_MakeFilter _T("MakeFilterCallback") #define kExportName_PrefsGetPrefsPath _T("PrefsGetPrefsPathCallback") #define kExportName_ResolveAddress _T("ResolveAddressCallback") #define kExportName_GetAppResourcePath _T("GetAppResourcePathCallback") typedef void * ClientAppDataPtr; #elif TARGET_OS_MAC struct PeekPlugCallbacks { GetProtocolNameProc mGetProtocolNameProc; GetProtocolLongNameProc mGetProtocolLongNameProc; GetProtocolHierNameProc mGetProtocolHierNameProc; GetProtocolParentProc mGetProtocolParentProc; GetProtocolColorProc mGetProtocolColorProc; IsDescendentOfProc mIsDescendentOfProc; NotifyProc mNotifyProc; LookupNameProc mLookupNameProc; LookupEntryProc mLookupEntryProc; AddNameEntryProc mAddNameEntryProc; SendPacketProc mSendPacketProc; SummaryGetEntryProc mSummaryGetEntryProc; SummaryModifyEntryProc mSummaryModifyEntryProc; PacketGetLayerProc mPacketGetLayerProc; PacketGetAddressProc mPacketGetAddressProc; PrefsGetValueProc mPrefsGetValueProc; PrefsSetValueProc mPrefsSetValueProc; InsertPacketProc mInsertPacketProc; SelectPacketsProc mSelectPacketsProc; EventDispatchProc mEventDispatchProc; }; struct ClientAppData { PeekPlugCallbacks mCallbacks; CFBundleRef mPluginBundle; }; typedef ClientAppData * ClientAppDataPtr; #endif // TARGET_OS_WIN32 // Handed to the plug-in in ioParam during kPluginMsg_Load. typedef struct PluginLoadParam { UInt32 fAPIVersion; TCHAR* fSerialNumber; TCHAR* fName; PluginID fID; UInt16 fAttributes; UInt16 fSupportedActions; UInt16 fDefaultActions; UInt32 fSupportedCount; UInt32* fSupportedProtoSpecs; ClientAppDataPtr fClientAppData; void* fAppContextData; // Plug retains to give back to callbacks. TCHAR* fLoadErrorMessage; LCID fLocaleId; bool fIsAppUnicode; } PluginLoadParam; typedef struct PluginProcessPacketParam { const PluginPacket* fPacket; const UInt8* fPacketData; UInt64 fPacketNumber; UInt8 fMediaType; UInt8 fMediaSubType; UInt32 fProtoSpecMatched; PluginContext fContext; } PluginProcessPacketParam; typedef struct PluginDecodePacketParam { const PluginPacket* fPacket; const UInt8* fPacketData; UInt64 fPacketNumber; UInt8 fMediaType; UInt8 fMediaSubType; UInt32 fProtoSpecMatched; PluginContext fContext; } PluginDecodePacketParam; typedef struct PluginGetPacketStringParam { const PluginPacket* fPacket; const UInt8* fPacketData; UInt64 fPacketNumber; UInt8 fMediaType; UInt8 fMediaSubType; UInt32 fProtoSpecMatched; TCHAR* fString; PluginColor fColor; PluginContext fContext; } PluginGetPacketStringParam; typedef struct PluginApplyParam { const PluginPacket* fPacket; const UInt8* fPacketData; UInt64 fPacketNumber; UInt8 fMediaType; UInt8 fMediaSubType; UInt32 fProtoSpecMatched; UInt16 fCommand; UInt32 fPrivateData; PluginContext fContext; } PluginApplyParam; typedef struct PluginSelectParam { const PluginPacket* fPacket; const UInt8* fPacketData; UInt64 fPacketNumber; UInt8 fMediaType; UInt8 fMediaSubType; UInt32 fProtoSpecMatched; UInt16 fCommand; UInt32 fPrivateData; PluginContext fContext; } PluginSelectParam; typedef struct PluginResetParam { PluginContext fContext; const TCHAR* fPluginAdapterID; } PluginResetParam; typedef struct PluginStartCaptureParam { PluginContext fContext; } PluginStartCaptureParam; typedef struct PluginStopCaptureParam { PluginContext fContext; } PluginStopCaptureParam; typedef struct PluginGetAdapterListParam { const TCHAR* fOutXMLAdapterList; UInt32 fOutXMLStreamLength; } PluginGetAdapterListParam; typedef struct PluginDeleteAdapterParam { const TCHAR* fInDeleteID; } PluginDeleteAdapterParam; typedef struct PluginAdapterPropertiesParam { const TCHAR* fInAdapterID; } PluginAdapterPropertiesParam; typedef struct PluginAdapterAttribsParam { const TCHAR* fAdapterID; const TCHAR* fInParamTagStream; UInt32 fInParamTagStreamLen; const TCHAR* fOutParamTagStream; UInt32 fOutParamTagStreamLen; } PluginAdapterAttribsParam; typedef struct PluginPacketsLoadedParam { PluginContext fContext; } PluginPacketsLoadedParam; typedef struct PluginSummaryParam { PluginContext fContext; } PluginSummaryParam; typedef struct PluginCreateContextParam { PluginContext* fContextPtr; PluginCaptureContext fCaptureContext; PluginContextData fContextData; PluginContextFlags fContextFlags; } PluginCreateContextParam; typedef struct PluginDisposeContextParam { PluginContext fContext; } PluginDisposeContextParam; typedef struct PluginFilterParam { const PluginPacket* fPacket; const UInt8* fPacketData; UInt8 fMediaType; UInt8 fMediaSubType; UInt32 fProtoSpecMatched; SInt16 fBytesAccepted; PluginContext fContext; } PluginFilterParam; typedef struct PluginNameTableUpdateParam { PluginNameTableEntry* fEntry; UInt16 fCommand; } PluginNameTableUpdateParam; typedef struct PluginCreateNewAdapterParam { TCHAR* fOutSelectedAdapterTag; UInt16 fInMaxLength; } PluginCreateNewAdapterParam; typedef union PluginParamBlock { PluginLoadParam uLoad; // kPluginMsg_Load PluginCreateContextParam uCreateContext; // kPluginMsg_CreateContext PluginDisposeContextParam uDisposeContext; // kPluginMsg_DisposeContext PluginProcessPacketParam uProcessPacket; // kPluginMsg_ProcessPacket PluginGetPacketStringParam uGetPacketString; // kPluginMsg_GetPacketString PluginApplyParam uApply; // kPluginMsg_Apply PluginSelectParam uSelect; // kPluginMsg_Select PluginResetParam uReset; // kPluginMsg_Reset PluginStartCaptureParam uStartCapture; // kPluginMsg_StartCatpure PluginStopCaptureParam uStopCapture; // kPluginMsg_StopCapture PluginPacketsLoadedParam uPacketsLoaded; // kPluginMsg_PacketsLoaded PluginSummaryParam uSummary; // kPluginMsg_Summary PluginFilterParam uFilter; // kPluginMsg_Filter PluginNameTableUpdateParam uNameTableUpdate; // kPluginMsg_NameTableUpdate PluginGetAdapterListParam uAdapterList; // kPluginMsg_GetAdapterList PluginCreateNewAdapterParam uCreateAdapter; // kPluginMsg_CreateNewAdapter PluginDeleteAdapterParam uDeleteAdapter; // kPluginMsg_DeleteAdapter PluginAdapterAttribsParam uAdapterAttribs; // kPluginMsg_SetAdapterAttribs, kPluginMsg_GetAdapterAttribs PluginDecodePacketParam uDecodePacket; // kPluginMsg_DecodePacket PluginAdapterPropertiesParam uAdapterProperties;// kPluginMsg_AdapterProperties } PluginParamBlock; // Error codes returned by plug-ins. #define PLUGIN_RESULT_SUCCESS 0 #define PLUGIN_RESULT_ERROR -1 // Used to Filter to mean accept the entire packet. #define PLUGIN_ACCEPT_WHOLE_PACKET 0 // Export name for the plug-in main entry point. #define kPluginMainProc "PlugInMain" #define kPluginInitProc "PlugInInitialize" #if TARGET_OS_WIN32 // Typedef for the main entry point of a plugin. typedef int (WINAPI *PluginProc)( SInt16 inMessage, PluginParamBlock* ioParams ); #elif TARGET_OS_MAC typedef pascal int (*PluginProc)( SInt16 inMessage, PluginParamBlock *ioParams ); #endif #define CallPluginProc(userRoutine, inMessage, ioParams) \ ((PluginProc)(userRoutine))((inMessage), (ioParams)) #pragma pack(pop) #ifdef __cplusplus } } /* end namespace */ #endif #endif /* PEEKPLUG_H */